const directiveObj = {
  install(Vue) {
    Vue.directive('foo', {
      inserted(el) {
        if (el.nodeName === 'TEXTAREA' || el.nodeName === 'INPUT') {
          el.focus()
        }
        const theInput = el.querySelector('input')
        const theTextarea = el.querySelector('textarea')
        if (theInput) el.querySelector('input')
        if (theTextarea) el.querySelector('textarea')
      },
      updated (el) {
        if (el.nodeName === 'TEXTAREA' || el.nodeName === 'INPUT') {
          el.focus()
        }
        const theInput = el.querySelector('input')
        const theTextarea = el.querySelector('textarea')
        if (theInput) el.querySelector('input')
        if (theTextarea) el.querySelector('textarea')
      }
    })
  }
}

export default directiveObj
